// Tencent is pleased to support the open source community by making ncnn available.
//
// Copyright (C) 2025 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.

package com.boby.homecamera.yolo;

import android.content.res.AssetManager;
import android.view.Surface;

import java.nio.ByteBuffer;

public class YOLO11Ncnn {
    public static class Object {
        public int label;
        public float prob;
        public float x;
        public float y;
        public float w;
        public float h;

        public Object(int label, float prob, float x, float y, float w, float h) {
            this.label = label;
            this.prob = prob;
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;
        }
    }
    public native boolean loadModel(AssetManager mgr, int taskid, int modelid, int cpugpu);
    public native boolean openCamera(int facing);
    public native boolean closeCamera();
    public native boolean setOutputWindow(Surface surface);
    // 新增接口：直接返回 Object 数组
    public native Object[] detectRGBA(byte[] rgba, int width, int height);
    // 新增: RGBA 检测接口
    public native Object[] detectRGBABuffer(ByteBuffer rgba, int width, int height, int rotation);


    static {
        System.loadLibrary("yolo11ncnn");
    }


}
